package k8s

import (
	"context"
	v1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/kubernetes"
)

func CreateNs(k8sClient *kubernetes.Clientset, ns string) error {
	// 	Create(ctx context.Context, namespace *v1.Namespace, opts metav1.CreateOptions) (*v1.Namespace, error)
	_, err := k8sClient.CoreV1().Namespaces().
		Create(context.Background(), &v1.Namespace{
			TypeMeta: metav1.TypeMeta{
				Kind:       "NameSpace",
				APIVersion: "v1",
			},
			ObjectMeta: metav1.ObjectMeta{
				Name: ns,
			},
		}, metav1.CreateOptions{})
	if err != nil {
		return err
	}
	return nil
}
